﻿using System.Windows;
using System.Windows.Input;

namespace Convertor.Plugin.SendEmail
{
    /// <summary>
    /// SmtpClientWindows.xaml 的交互逻辑
    /// </summary>
    public partial class SmtpClientWindows : Window
    {
        public SmtpClientViewModel Config { get; set; }
        public SmtpClientWindows()
        {
            InitializeComponent();
        }

        private bool close;
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.IsActive && e.Key == Key.Escape)
            {
                close = true;
            }
        }

        private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            if (this.IsActive && e.Key == Key.Escape && close)
            {
                this.Close();
            }
        }
        private void Button_OK_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();
        }

        private void Button_Cancel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}
